package asteroids.model.programs.statements;

import java.util.Collection;

import exception.StopActionClassException;


import asteroids.model.programs.Program;

public class Sequence extends Statement {
	
	public Sequence(Collection<Statement> sequence){
		this.sequence = sequence;
	}
	
	public Collection<Statement> getStatements(){
		return this.sequence;
	}
	
	
	
	
	private Collection<Statement> sequence;




	@Override
	public void execute(Program program) throws StopActionClassException {
		if(!isExecuted()){
		for(Statement statement: getStatements()){
			statement.execute(program);
		}
		setExecuted();
		}
	}

	@Override
	public void reset() {
		setUnexecuted();
		for(Statement statement: getStatements())
			statement.reset();
	}

}
